package entity;

import lombok.Data;
import lombok.experimental.Accessors;


import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;


//@Entity
//@Table(name = "t_user")
public class User extends BaseEntity {

    private String id;
    //姓名
    private String name;
    //用户名
    private String username;
    //密码
//    @Column(name = "password",nullable = false)
    private String password;
    //生日
//    @Column(name = "birthday")
    private Date birthDay;
    //头像地址
//    @Column(name = "avatar_path")
    private String avatarPath;


    // 级联属性
    private Set<Address> addresses = new HashSet<>();
    private Set<Order> orders = new HashSet<>();

    @Override
    public String toString() {
        return "User{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", birthDay=" + birthDay +
                ", avatarPath='" + avatarPath +
                '}';
    }

    public User(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public User() {
    }
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Date getBirthDay() {
        return birthDay;
    }

    public void setBirthDay(Date birthDay) {
        this.birthDay = birthDay;
    }

    public String getAvatarPath() {
        return avatarPath;
    }

    public void setAvatarPath(String avatarPath) {
        this.avatarPath = avatarPath;
    }

    public Set<Address> getAddresses() {
        return addresses;
    }

    public void setAddresses(Set<Address> addresses) {
        this.addresses = addresses;
    }

    public Set<Order> getOrders() {
        return orders;
    }

    public void setOrders(Set<Order> orders) {
        this.orders = orders;
    }
}
